using ZR.Model.Enums;

namespace ZR.Model.BaseFrame.Dto
{
    /// <summary>
    /// 角色表单对象
    /// </summary>
    public class RoleFormDtoBase
    {      
        /// <summary>
        /// 角色标识
        /// </summary>
        [Required(ErrorMessage = "角色标识不能为空")]
        [ExcelColumn(Name = "角色标识")]
        [ExcelColumnName("角色标识")]
        public long RoleId { get; set; }
        
        /// <summary>
        /// 角色名称
        /// </summary>
        [Required(ErrorMessage = "角色名称不能为空")]
        [ExcelColumn(Name = "角色名称")]
        [ExcelColumnName("角色名称")]
        public string RoleName { get; set; }
        
        /// <summary>
        /// 角色类型
        /// </summary>
        [Required(ErrorMessage = "角色类型不能为空")]
        [ExcelColumn(Name = "角色类型")]
        [ExcelColumnName("角色类型")]
        public string RoleTypeCode { get; set; }
        
        /// <summary>
        /// 是否超级管理员
        /// </summary>
        [Required(ErrorMessage = "是否超级管理员不能为空")]
        [ExcelColumn(Name = "是否超级管理员")]
        [ExcelColumnName("是否超级管理员")]
        public bool IsSuperAdmin { get; set; }
        
        /// <summary>
        /// 状态
        /// </summary>
        [Required(ErrorMessage = "状态不能为空")]
        [ExcelColumn(Name = "状态")]
        [ExcelColumnName("状态")]
        public string StateCode { get; set; }
        
        /// <summary>
        /// 角色描述
        /// </summary>
        [ExcelColumn(Name = "角色描述")]
        [ExcelColumnName("角色描述")]
        public string RoleDesc { get; set; }
        

    }

    /// <summary>
    /// 删除角色请求对象
    /// </summary>
    public class DeleteRoleReqBase
    {
        /// <summary>
        /// 标识集合
        /// </summary>
        public string Ids { get; set; }
    }

    /// <summary>
    /// 变更角色状态请求对象
    /// </summary>
    public class ChangeRoleStateReqBase
    {
        /// <summary>
        /// 标识
        /// </summary>
        public long Id { get; set; }
        
        /// <summary>
        /// 状态编码
        /// </summary>
        public string StateCode { get; set; }
        
        /// <summary>
        /// 状态枚举
        /// </summary>
        [JsonIgnore]
        public DataStateEnum? StateEnum
        {
            get
            {
                DataStateEnum stateEnum;
                var isOk = Enum.TryParse(StateCode, true, out stateEnum);
                if (isOk && Enum.IsDefined(stateEnum))
                {
                    return stateEnum;
                }
                return null;
            }
        }
    }


    /// <summary>
    /// 获取角色分页列表请求对象
    /// </summary>
    public class GetRolePageListReqBase : PagerInfo 
    {

        /// <summary>
        /// 关键词
        /// </summary>
        public string Keywords { get; set; }

        /// <summary>
        /// 角色类型
        /// </summary>
        public string RoleTypeCode { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public string StateCode { get; set; }


    }

    /// <summary>
    /// 角色列表项
    /// </summary>
    public class RoleListItemDtoBase
    {
        [ExcelColumn(Name = "角色标识")]
        [ExcelColumnName("角色标识")]
        /// <summary>
        /// 角色标识
        /// </summary>
        public long RoleId { get; set; }
        
        [ExcelColumn(Name = "角色名称")]
        [ExcelColumnName("角色名称")]
        /// <summary>
        /// 角色名称
        /// </summary>
        public string RoleName { get; set; }
        
        [ExcelColumn(Name = "角色类型")]
        [ExcelColumnName("角色类型")]
        /// <summary>
        /// 角色类型
        /// </summary>
        public string RoleTypeCode { get; set; }
        
        [ExcelColumn(Name = "是否超级管理员")]
        [ExcelColumnName("是否超级管理员")]
        /// <summary>
        /// 是否超级管理员
        /// </summary>
        public bool IsSuperAdmin { get; set; }
        
        [ExcelColumn(Name = "状态")]
        [ExcelColumnName("状态")]
        /// <summary>
        /// 状态
        /// </summary>
        public string StateCode { get; set; }
        
        [ExcelColumn(Name = "创建时间", Format = "yyyy-MM-dd HH:mm:ss", Width = 20)]
        [ExcelColumnName("创建时间")]
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }
        
        [ExcelColumn(Name = "创建人")]
        [ExcelColumnName("创建人")]
        /// <summary>
        /// 创建人
        /// </summary>
        public string Creater { get; set; }
        
    }

    /// <summary>
    /// 角色详情
    /// </summary>
    public class RoleDetailDtoBase: RoleFormDto
    {

    }
}